<!DOCTYPE html>
<html lang="en">
<head>
    {% block head %}
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="description" content="Freshermeat - {{ config.FRESHERMEAT_INSTANCE_NAME }}" />
    <meta name="author" content="" />
    <link href="{{ url_for('recent_releases') }}" rel="alternate" title="Recent releases" type="application/atom+xml" />
    <link href="{{ url_for('recent_cves') }}" rel="alternate" title="Recent CVEs" type="application/atom+xml" />
    {% block head_css %}
    <link rel="stylesheet" href="{{ url_for('static', filename='npm_components/bootstrap/dist/css/bootstrap.min.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='npm_components/bootstrap-select/dist/css/bootstrap-select.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='npm_components/datatables.net-bs4/css/dataTables.bootstrap4.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='css/custom.css') }}" />
    <link rel="stylesheet" href="{{ url_for('static', filename='npm_components/fork-awesome/css/fork-awesome.min.css') }}" />
    {% endblock %}
    <script src="{{ url_for('static', filename='npm_components/jquery/dist/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/popper.js/dist/umd/popper.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/bootstrap/dist/js/bootstrap.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/bootstrap-select/dist/js/bootstrap-select.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/datatables.net/js/jquery.dataTables.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/datatables.net-bs4/js/dataTables.bootstrap4.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/lodash/lodash.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/moment/min/moment.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/tinymce/tinymce.min.js') }}"></script>
    <script src="{{ url_for('static', filename='npm_components/chart.js/dist/Chart.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/utils.js') }}"></script>
    <script src="{{ url_for('static', filename='js/templates.js') }}"></script>
    <title>{% if head_titles %}{{ ' - '.join(head_titles + ['']) }}{% endif %}
            {% if config.FRESHERMEAT_INSTANCE_NAME %}{{ config.FRESHERMEAT_INSTANCE_NAME }}{% else %}Freshermeat{% endif %}
            {% if head_titles_tail %}{{ ' - '.join([''] + head_titles_tail) }}{% endif %}
    </title>
    {% endblock %}
</head>
{% block page_body %}
<body>
{% block main_menu %}
    <nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark">
        <a class="navbar-brand d-inline-block  text-truncate" href="/">{% if config.FRESHERMEAT_INSTANCE_NAME  %}{{ config.FRESHERMEAT_INSTANCE_NAME }}{% else %}Freshermeat{% endif %}</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="fa fa-bars fa-2"></span>
        </button>

        {% block menu_links %}
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto w-100 justify-content-end">
                {% if not current_user.is_authenticated %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('projects_bp.list_projects') }}" title="Projects">Projects</a>
                </li>
                {% else %}
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Projects</a>
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="{{ url_for('projects_bp.list_projects') }}" title="Projects">List projects</a>
                        <a class="dropdown-item" href="{{ url_for('project_bp.form') }}">Add new project</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item">
                            <form action="{{ url_for('project_bp.import_project', import_from='gitlab') }}" class="form-row input-inline" method="GET" name="import">
                                <div class="input-group mb-3">
                                    <input class="form-control" type="url" name="project" id="inlineFormInputGroupGitLab" placeholder="GitLab link" aria-label="GitLab link" required />
                                    <div class="input-group-append">
                                        <button type="submit" class="btn btn-outline-secondary"><i class="fa fa-download" title="Import from GitLab"></i></button>
                                    </div>
                                </div>
                            </form>
                        </a>
                        <a class="dropdown-item">
                            <form action="{{ url_for('project_bp.import_project', import_from='github') }}" class="form-row input-inline" method="GET" name="import">
                                <div class="input-group mb-3">
                                    <input class="form-control" type="url" name="project" id="inlineFormInputGroupGitHub" placeholder="GitHub link" aria-label="GitHub link" required />
                                    <div class="input-group-append">
                                        <button type="submit" class="btn btn-outline-secondary"><i class="fa fa-download" title="Import from GitHub"></i></button>
                                    </div>
                                </div>
                            </form>
                        </a>
                    </div>
                </li>
                {% endif %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('organizations_bp.list_organizations') }}" title="Organizations">Organizations</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('stats_bp.stats') }}" title="Statistics">Statistics</a>
                </li>
                {% if current_user.is_authenticated %}
                {% if current_user.is_admin %}
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-cogs" aria-hidden="true"></i></a>
                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
                        <a class="dropdown-item" href="{{ url_for('admin_bp.dashboard') }}">Dashboard</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{{ url_for('admin_bp.list_users') }}">Users</a>
                        <a class="dropdown-item" href="{{ url_for('submissions_bp.list_submissions') }}">Submissions</a>
                        <a class="dropdown-item" href="{{ url_for('admin_bp.requests') }}">Requests</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="/admin">Data</a>
                    </div>
                </li>
                {% endif %}
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownUser" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-user" aria-hidden="true"></i></a>
                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownUser">
                        <span class="dropdown-item" title="Schemas"><span class="text-muted">Signed in as</span><br /><b>{{ current_user.login }}</b></span>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{{ url_for('user_bp.form') }}" title="Profile">Profile</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{{ url_for('logout') }}" title="Sign out">Sign out</a>
                    </div>
                </li>
                {% else %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('about') }}" title="About">About</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('login') }}" title="Sign in"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
                </li>
                {% endif %}
            </ul>
        </div>
        {% endblock %}
    </nav>
{% endblock %}


<div class="container alert-message">
{% block messages %}
    {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            <br />
            {% for category, message in messages %}
                <div class="alert alert-{{category}}">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    {{ message }}
                </div>
            {% endfor %}
        {% endif %}
    {% endwith %}
{% endblock %}
</div>
{% block content %}{% endblock %}
<br />
<footer class="footer">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <a href="{{ url_for('about') }}" >About</a>
            </div>
        </div>
    </div>
</footer>
</body>
{% endblock %}
</html>
